import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-04-23
 * Time: 22:01
 */
import java.io.*;
public class print_writer {
        public static void main(String[] args) throws IOException {
            try(OutputStream os=new FileOutputStream("C:\\Users\\22652\\Desktop\\程序\\iron\\Java_4_23\\take.txt")){
                OutputStreamWriter osWriter = new OutputStreamWriter(os, "utf-8");
                PrintWriter writer = new PrintWriter(osWriter);
                // 接下来我们就可以方便的使用 writer 提供的各种方法了
                writer.print("Hello\n");
                writer.print("你好");
                writer.printf("%d: %s\n", 1, "没什么");
// 不要忘记 flush
                writer.flush();
            }
    }
}
